package com.stone;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.List;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class Store {
	
	private static int index = 0;

	public static void main(String[] args) throws Exception {

		File file = new File("job/gfan/info");
		File[] files = file.listFiles();
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < files.length; i++) {
			File[] wenjian = files[i].listFiles();
			String title = files[i].getName();
			sb = new StringBuffer();

			for (int j = 0; j < wenjian.length; j++) {
				BufferedReader is = new BufferedReader(new InputStreamReader(
						new FileInputStream(wenjian[j])));
				String str;
				while ((str = is.readLine()) != null) {
					Gson gson = new Gson();
					GameInfo ginfo = gson.fromJson(str,
							new TypeToken<GameInfo>() {
							}.getType());
					DB db = new DB();
					db.update(ginfo);
					db.close();
					System.out.println("插入"+index);
					index++;
				}
				is.close();
			}

		}
	}

}
